package com.example.service.siyunDingdanService.impl;

import com.example.dao.siyunDingdanDao.SiyunDingdanDao;
import com.example.pojo.siyunDingdanPojo.SiyunDingdan;
import com.example.pojo.siyunDingdanPojo.SiyunDingdanGenzong;
import com.example.pojo.siyunDingdanPojo.SiyunDingdanStatus;
import com.example.pojo.siyunDingdanPojo.SiyunShopDingdanPlus;
import com.example.service.siyunDingdanService.SiyunDingdanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SiyunDingdanServiceImpl implements SiyunDingdanService {
    @Autowired
    private SiyunDingdanDao siyunDingdanDao;

    @Override
    public SiyunDingdanStatus getShopDingdanAlltype(Integer orderType) {
        List<SiyunDingdan> shopDingdanAlltype = siyunDingdanDao.getShopDingdanAlltype(orderType);
        SiyunDingdanStatus a = new SiyunDingdanStatus();
        //全部订单
        Integer all =0;
        //待付款
        Integer fukuan =0;
        //待发货
        Integer dfahuo =0;
        //已发货
        Integer yfahuo =0;
        //已完成
        Integer wancheng =0;
        //已取消
        Integer quxiao =0;
        for (SiyunDingdan siyunDingdan : shopDingdanAlltype) {
            all++;
            if (siyunDingdan.getOrderStatus() == 2) {
                fukuan++;
            } else if (siyunDingdan.getOrderStatus() == 4) {
                dfahuo++;
            } else if (siyunDingdan.getOrderStatus() == 5) {
                yfahuo++;
            } else if (siyunDingdan.getOrderStatus() == 6) {
                wancheng++;
            } else if (siyunDingdan.getOrderStatus() == 10) {
                quxiao++;
            }
        }
        a.setAlldingdan(all);
        a.setFukuan(fukuan);
        a.setDfahuo(dfahuo);
        a.setYfahuo(yfahuo);
        a.setWancheng(wancheng);
        a.setQuxiao(quxiao);
        return a;
    }

    @Override
    public List<SiyunDingdan> getShopDingdanAll(SiyunDingdan siyunDingdan) {
        return siyunDingdanDao.getShopDingdanAll(siyunDingdan);
    }

    @Override
    public List<SiyunDingdan> getShopMohuCha(SiyunDingdan siyunDingdan) {
        return siyunDingdanDao.getShopMohuCha(siyunDingdan);
    }

    @Override
    public SiyunShopDingdanPlus getShopDingdanChaxunAll(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getShopDingdanChaxunAll(siyunShopDingdanPlus);
    }

    @Override
    public Boolean getShopDelete(Integer orderNo) {
        return siyunDingdanDao.getShopDelete(orderNo);
    }

    @Override
    public Boolean getUpdateDingdan(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getUpdateDingdan(siyunShopDingdanPlus);
    }

    @Override
    public Boolean getUpdateRemarks(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getUpdateRemarks(siyunShopDingdanPlus);
    }

    @Override
    public SiyunShopDingdanPlus getSousuoShop(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getSousuoShop(siyunShopDingdanPlus);
    }

    @Override
    public Boolean getUpdateShop(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getUpdateShop(siyunShopDingdanPlus);
    }

    @Override
    public List<SiyunDingdanGenzong> getGenzongDingdan(SiyunDingdanGenzong siyunDingdanGenzong) {
        return siyunDingdanDao.getGenzongDingdan(siyunDingdanGenzong);
    }

    @Override
    public boolean getUpdateImg(SiyunShopDingdanPlus siyunShopDingdanPlus) {
        return siyunDingdanDao.getUpdateImg(siyunShopDingdanPlus);
    }
}
